//flaglever.txt - Lever which, when pulled, moves a wall aside.
//Cell 0,1 - The x,y coordinate of the wall to clear.
// Cell 2 - skill needed, if 0 none

beginobjectscript; 

variables;

body;

variables;
	short opened = 0;

body;

beginstate INIT_STATE;

	break;

beginstate DEAD_STATE;

break;

beginstate START_STATE; // door closed, waiting
break;

beginstate USE_STATE;
	if (opened > 0) {
		print_str("Pull Lever: It's stuck in this position.");
		end();
		}
		
	if ((get_memory_cell(2) > 0) && (get_stat(21) < get_memory_cell(2))) {
		print_str("Pull Lever: It has a complex locking mechanism, and you can't figure out");
		print_str("  how to release it.");
		end();
		}
		
	opened = 1;
	set_terrain(get_memory_cell(0),get_memory_cell(1),0);
	print_str("Pull Lever: You pull the lever. You hear a rumbling sound.");
	set_object_icon(ME,11);
	play_sound(246);
break;
